<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
        content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>高压氧多重耐药患者治疗舱消毒记录单填写-form</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <link rel="stylesheet" type="text/css" href="../css/aui.2.0.css" />
    <style>
        .form-container {
            width: 100%;
            padding-top: 20px;
        }

        .form-container>h2 {
            margin: 0 auto;
            width: 500px;
        }

        .form-container>.form-wrapper {
            display: -webkit-flex;
            display: flex;
            justify-content: flex-start;
            flex-wrap: wrap;
            padding-top: 20px;
        }

        .form-container>.form-wrapper>div {
            width: 50%;
            margin-top: 10px;
        }

        .form-container>.form-wrapper>div>span {
            vertical-align: middle;
        }

        .form-container>.form-wrapper>div>span:nth-child(1) {
            display: inline-block;
            width: 30%;
            height: 30px;
            font-size: 14px;
            text-align: center;
        }

        .form-container>.form-wrapper>div>input {
            display: inline-block;
            width: 70%;
            height: 25px !important;
            font-size: 14px;
            text-align: center;
            vertical-align: middle;
            overflow: hidden;
            border: 1px solid rgba(0, 0, 0, 0.3);
        }

        .aui-form-list-wrapper,
        .aui-form-list-info-wrapper {
            display: flex;
            display: -webkit-flex;
            justify-content: flex-start;
            flex-wrap: wrap;
            margin: 10px 0;
        }

        .aui-form-list-wrapper>li,
        .aui-form-list-info-wrapper>li {
            width: 50%;
        }

        .aui-list-item-label {
            width: 60% !important;
        }

        .form-submit {
            width: 100%;
            text-align: center;
            margin-top: 50px;
        }

        .form-submit>button {
            width: 170px;
            height: 50px;
            text-align: center;
            background-color: #0064B0;
            color: #fff;
            padding-bottom: 10px;
            font-size: 20px;
        }

        .aui-list-item-label,
        .aui-list-item-input,
        input[type="text"] {
            font-size: 0.6rem;
        }
    </style>
</head>

<body>
    <main id="app">
        <div class="form-container" style="text-align:center;">

            <!-- <h2>多重耐药菌患消毒记录单</h2> -->
            <div class="aui-content aui-margin-b-15">
                <ul class="aui-list aui-form-list aui-form-list-wrapper">
                    <li class="aui-list-item">
                        <div class="aui-list-item-inner">
                            <div class="aui-list-item-label">
                                科室：
                            </div>
                            <div class="aui-list-item-input">
                                <input type="text" placeholder="科室" id="trSectionSource">
                            </div>
                        </div>
                    </li>
                    <li class="aui-list-item">
                        <div class="aui-list-item-inner">
                            <div class="aui-list-item-label">
                                姓名：
                            </div>
                            <div class="aui-list-item-input">
                                <input type="text" placeholder="姓名" id="aiName">
                            </div>
                        </div>
                    </li>
                    <li class="aui-list-item">
                        <div class="aui-list-item-inner">
                            <div class="aui-list-item-label">
                                年龄：
                            </div>
                            <div class="aui-list-item-input">
                                <input type="text" placeholder="年龄" id="aiAge">
                            </div>
                        </div>
                    </li>
                    <li class="aui-list-item">
                        <div class="aui-list-item-inner">
                            <div class="aui-list-item-label">
                                住院号：
                            </div>
                            <div class="aui-list-item-input">
                                <input type="text" placeholder="住院号" id="trPatientNo">
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
            <div class="aui-content aui-margin-b-15">
                <ul class="aui-list aui-form-list aui-form-list-info-wrapper">
                    <li class="aui-list-item">
                        <div class="aui-list-item-inner">
                            <div class="aui-list-item-label">
                                日期：
                            </div>
                            <div class="aui-list-item-input">
                                <input type="text" placeholder="日期" value="2020-12-01" id="mrTime">
                            </div>
                        </div>
                    </li>

                    <li class="aui-list-item">
                        <div class="aui-list-item-inner">
                            <div class="aui-list-item-label">
                                签名：
                            </div>
                            <div class="aui-list-item-input">
                                <input type="text" placeholder="签名" id="F_DisRecordSign">
                            </div>
                        </div>
                    </li>
                    <li class="aui-list-item">
                        <div class="aui-list-item-inner">
                            <div class="aui-list-item-label">
                                消毒舱壁：
                            </div>
                            <div class="aui-list-item-input">
                                <select id="mrBulkhead">
                                    <option value="1">✔</option>
                                    <option value="0">✖</option>
                                </select>
                            </div>
                        </div>
                    </li>
                    <li class="aui-list-item">
                        <div class="aui-list-item-inner">
                            <div class="aui-list-item-label">
                                消毒台面：
                            </div>
                            <div class="aui-list-item-input">
                                <select id="mrMesa">
                                    <option value="1">✔</option>
                                    <option value="0">✖</option>
                                </select>
                            </div>
                        </div>
                    </li>
                    <li class="aui-list-item">
                        <div class="aui-list-item-inner">
                            <div class="aui-list-item-label">
                                消毒地面：
                            </div>
                            <div class="aui-list-item-input">
                                <select id="mrGround">
                                    <option value="1">✔</option>
                                    <option value="0">✖</option>
                                </select>
                            </div>
                        </div>
                    </li>
                    <li class="aui-list-item">
                        <div class="aui-list-item-inner">
                            <div class="aui-list-item-label">
                                空气消毒：
                            </div>
                            <div class="aui-list-item-input">
                                <select id="mrAirDisinfect">
                                    <option value="1">✔</option>
                                    <option value="0">✖</option>
                                </select>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
        <div class="form-submit">
            <button onclick="Query_getHoTreatmentRegister()">1、获取信息</button>
            <button onclick="Insert_HO_DcnyjhzlcDisinfectionRecord()">2、保存信息</button>
        </div>
    </main>
    <input type="text" id="mrTrId" style="display: none">
</body>

</html>
<script src="../script/api.js" charset="utf-8" type="text/javascript"></script>
<script src="../script/vue.js" charset="utf-8" type="text/javascript"></script>
<script src="../js/jquery.min.js" charset="utf-8" type="text/javascript"></script>
<script src="../js/ToConfigure.js" charset="utf-8" type="text/javascript"></script>
<script src="../script/aui-toast.js" charset="utf-8" type="text/javascript"></script>
<script src="../script/aui-dialog.js" charset="utf-8" type="text/javascript"></script>
<script src="../script/aui-tab.js" charset="utf-8" type="text/javascript"></script>

<script type="text/javascript">
    var vm;
    apiready = function () {
        vm = new Vue({
            el: '#app',
            data: {
                getDateTime: '选择日期'
            },
            watch: {
                searchInfo: function () { }
            },
            methods: {

            }
        })
    }

    function getDateTime() {
        api.openPicker({
            type: 'date',
            date: '2019-01-01',
            title: '选择开始日期'
        }, function (ret, err) {
            if (ret) {
                api.openPicker({
                    type: 'time',
                    date: "2016-07-28 09:00",
                    title: '请选择时间'
                }, function (ret1, err1) {
                    if (ret1) {
                        vm.getDateTime = '' + ret1.year +
                            '年' + ret1.month +
                            '月' + ret1.day +
                            '日' + ret1.hour +
                            '时' + ret1.minute +
                            '分'
                    } else {
                        console.log(JSON.stringify(err1));
                    }
                });
            }
        });
    }

    function closewin() {
        api.closeWin({
            name: 'disinfection-record-form'
        });
    }



    //添加多重耐药菌治疗患者
    function Insert_HO_DcnyjhzlcDisinfectionRecord() {
        var JsonStr = GetParameters();
        //获取所属医院IP
        var UrlIP = ToConfigure_IP("Gorgeous");
        $.ajax({
            url: UrlIP + '/disinfectioninspection/homultidrugresistance/insertHoMultidrugResistance',
            type: 'post',
            async: false,
            contentType: "application/json",
            dataType: "json",
            data: JsonStr,
            success: function (result) {
                /**
                 * 验证返回信息是否为空
                 */
                if (result.success == true) {
                    JumpPage();
                } else {
                    /**
                     *  提示错误信息
                     */
                    toast.fail({
                        title: "加载失败",
                        duration: 2000
                    });
                }
            },
            error: function (result) {
                /**
                 *  提示错误信息
                 */
                toast.fail({
                    title: "加载失败",
                    duration: 2000
                });
            }
        })

    }

    //跳转页面
    function JumpPage() {
        var dialog = new auiDialog();
        dialog.alert({
            title: "提示",
            msg: '操作成功，是否跳转多重耐药记录单',
            buttons: ['取消', '确定']
        }, function (ret) {
            if (ret.buttonIndex === 1) {

            } else if (ret.buttonIndex === 2) {
                api.openFrame({ // 打开Frame
                    name: 'disinfection-record-header',
                    url: './disinfection-record-header.html',
                });
            }
        })
    }
    //根据条件查询
    function Query_getHoTreatmentRegister() {
        if ($("#trPatientNo").val() != "" && $("#trPatientNo").val() != null) {
            //定义toast提示框
            var toast = new auiToast();
            //获取所属医院IP地址
            var Url_IP = ToConfigure_IP("Gorgeous");
            var Js_Parms = new Object();
            Js_Parms.trPatientNo = $("trPatientNo").val();
            var json_Str = JSON.stringify(Js_Parms);
            /**
             * 请求控制器
             */
            $.ajax({
                url: Url_IP + '/businessmanagement/hotreatmentregister/getHoTreatmentRegister',
                type: 'post',
                async: false,
                contentType: "application/json",
                dataType: "json",
                data: json_Str,
                success: function (result) {
                    /**
                     * 验证返回信息是否为空
                     */
                    if (result.success == true) {
                        $.each(result.data.list, function (i, o) {
                            $("#mrTrId").val(o.trId);
                            $("#trPatientNo").val(o.trPatientNo)
                            $("#aiName").val(o.hoArchivalInformationEntity.aiName)
                            $("#aiAge").val(o.hoArchivalInformationEntity.aiAge)
                            $("#trSectionSource").val(o.trSectionSource)
                        })
                        api.hideProgress();
                        toast.success({
                            title: "获取成功",
                            duration: 1000
                        });
                    } else {
                        api.hideProgress();
                        toast.fail({
                            title: "获取失败",
                            duration: 2000
                        });
                    }
                },
                error: function (result) {
                    api.hideProgress();
                    toast.fail({
                        title: "获取失败",
                        duration: 2000
                    });
                }
            });
        } else {
            alert("请填写住院号");
        }

    }
    //获取参数添氧舱消毒记录
    function GetParameters() {
        var JsParms = new Object();
        //获取日期
        JsParms.mrTime = document.getElementById("mrTime").value;
        //消毒舱壁
        JsParms.mrBulkhead = document.getElementById("mrBulkhead").value;
        //消毒台面
        JsParms.mrMesa = document.getElementById("mrMesa").value;
        //消毒地面
        JsParms.mrGround = document.getElementById("mrGround").value;
        //空气消毒
        JsParms.mrAirDisinfect = document.getElementById("mrAirDisinfect").value;
        //治疗登记表id
        JsParms.mrTrId = document.getElementById("mrTrId").value;

        //api.getPrefs获取当前登录状态
        api.getPrefs({
            key: 'User_Id'
        }, function (ret, err) {
            //当偏好设置尚未设置或者曾设置后被移除后，返回值(ret.value)均为空。
            var val = ret.value;
            if (val != "") {
                //操作人
                JsParms.CreateName = val;
            } else {
                //未登录
                return "";
            }
        });

        return JSON.stringify(JsParms);
    }
</script>